﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MaxLeaf.KH.DataContract;
using System.Xml;
using System.Web;
using CommonsLib.Settings;
using MaxLeaf.KH.Contract;

namespace MaxLeaf.KH.BLLProxy
{
    public abstract class BaseBLLProxy 
    {
        

         
        public    IDictionary<string, object> Execute(string cmd, IDictionary<string, object> inputData)
        {
             

            LogManager.Debug("Bllproxyexecute ");
            Dictionary<string, object> outputData = new Dictionary<string, object>();
            try
            {
                 
                outputData = (Dictionary<string, object>)ExecuteCmd(cmd, inputData);
                 
                 
            }
            catch (Exception ex)
            {
                outputData["error"] = ex.Message;
                LogManager.Error(ex);
            }

            return outputData;

        }

        public abstract   IDictionary<string, object> ExecuteCmd(string cmd, IDictionary<string, object> inputData);
         

        
        public int Access_Mode
        {
            get
            {
                return GetClient().AccessMode;
            }

        }

        private WCFClientInfo GetClient()
        {
            return MaxLeaf.KH.Settings.Configs.GetBLLProxyInfo(this.GetType().Name);
        }

        public List<WCFConfigInfo> WCF_Configs
        {
            get
            {
                return GetClient().WCF;
            }

        }

         
    }
}
